#include <cctype>
#include<iostream>
#include<string.h>
#define MaxSize 500
using namespace std;
typedef char ElementType;
typedef int Position;
typedef struct SNode {
    ElementType Data;
    struct SNode *next; 
}Stack;

void InitStack(Stack *&s);
void DestoryStack(Stack *&s);
bool StackEmpty(Stack *s);
void Push(Stack *&s,ElementType e);
bool Pop(Stack *&s,ElementType &e);
bool GetTop(Stack *s,ElementType &e); 
int main()  
{  
	char ch1[30],ch2[30]="\0",ch;
	Stack* st;
	InitStack(st);
	Push(st,'=');
	cin>>ch1;
	int i=0,j=0;
	for(i=0;ch1[i];i++){
		if(isdigit(ch1[i])||ch1[i]=='.'){
			if(ch1[i+1]){
				if(isdigit(ch1[i+1])||ch1[i+1]=='.'){
					ch2[j++]=ch1[i];
				}
				else {
					ch2[j++]=ch1[i];
					ch2[j++]='#';
				}
			}
			else {
				ch2[j++]=ch1[i];
				ch2[j++]='#';
			}
		}
		else if((ch1[i]=='+'||ch1[i]=='-')&&(i==0||ch1[i-1]=='(')&&(isdigit(ch1[i+1])))
				ch2[j++]=ch1[i],ch2[j++]='#';
		else if((ch1[i]=='+'||ch1[i]=='-'||ch1[i]=='*'||ch1[i]=='/')&&GetTop(st,ch)==1&&ch=='='){
			Push(st,ch1[i]);
		}
		else if((ch1[i]=='*'||ch1[i]=='/')&&GetTop(st,ch)==1&&(ch=='+'||ch=='-')){
			Push(st,ch1[i]);
		} 
		else if((ch1[i]=='*'||ch1[i]=='/')&&GetTop(st,ch)==1&&(ch=='*'||ch=='/')){
			Pop(st,ch);ch2[j++]=ch;
			while(1){
				if((ch1[i]=='*'||ch1[i]=='/')&&GetTop(st,ch)==1&&(ch=='*'||ch=='/'))
					Pop(st,ch),ch2[j++]=ch;
				else break;
			}	
			Push(st,ch1[i]);
		}
		else if(ch1[i]=='(') Push(st,ch1[i]);
		else if((ch1[i]=='+'||ch1[i]=='-'||ch1[i]=='*'||ch1[i]=='/')&&GetTop(st,ch)==1&&ch=='('){
			Push(st,ch1[i]);
		}
		else if(ch1[i]==')'){
			if(GetTop(st,ch)==1&&ch!='('){
				while(1){
					Pop(st,ch);
					if(ch!='(')ch2[j++]=ch;
					else break;
				}
			}
			else Pop(st,ch);
		}
		else if((ch1[i]=='+'||ch1[i]=='-')&&GetTop(st,ch)==1&&(ch=='*'||ch=='/'||ch=='+'||ch=='-')){
			Pop(st,ch);ch2[j++]=ch;
			while(1){
				if((ch1[i]=='+'||ch1[i]=='-')&&GetTop(st,ch)==1&&(ch=='*'||ch=='/'||ch=='+'||ch=='-'))
					Pop(st,ch),ch2[j++]=ch;
				else break;
			}	
			Push(st,ch1[i]);
		}
	}
	while(GetTop(st,ch)==1&&ch!='='){
		ch2[j++]=ch;Pop(st,ch);
	}
	ch2[j]='\0';
	for(i=0;i<j;i++){
		if(ch2[i]!='#'){
			if(ch2[i]=='+'&&ch2[i+1]=='#')continue;
			cout<<ch2[i];
			if(((ch2[i]=='+'||ch2[i]=='-')&&ch2[i+1]=='#')||
			(isdigit(ch2[i])&&ch2[i+1]=='.')||
			(isdigit(ch2[i])&&ch2[i+1]!='#')||
			(ch2[i]=='.'&&isdigit(ch2[i+1])))continue;
			if((i==j-2)&&ch2[i+1]=='#')break;
			if(i!=j-1)cout<<' ';
		}
	}
}
void InitStack(Stack *&s){
    s=new Stack;
	s->next=NULL;
}
void DestoryStack(Stack *&s){
	Stack *p=s,*q=s->next;
	while(q!=NULL){
		delete p;
		p=q;
		q=p->next;
	}
	delete p;
}
bool StackEmpty(Stack *s){
	return (s->next==NULL);
}
void Push(Stack *&s,ElementType e){ 
    Stack* p;
    p=new Stack;
    p->Data=e;
    p->next=s->next;
	s->next=p; 
}

bool Pop(Stack *&s,ElementType &e){
	Stack *p;
	if(s->next==NULL)return false;
	p=s->next;
	e=p->Data;
	s->next=p->next;
	delete p;
	return true; 
}
bool GetTop(Stack *s,ElementType &e){
	if(s->next==NULL)return false;
	e=s->next->Data;
	return true;
}
